/*	kd:
	
	We typically don't bother messing with targets we look at with the super
	sheep, so we only need this a static function to get us a target position
	when hitting hostiles. */

struct GCSheepBaton play {
	private static void StandardTrace (
			Actor			user,
		out	FLineTraceData	data,
			float			height = 41,
			bool			ignore_actors = false) {
		
		user.LineTrace(
			user.angle,
			666999.666,
			user.pitch,
			TRF_THRUBLOCK | TRF_THRUHITSCAN | (ignore_actors ? TRF_THRUACTORS : 0),
			height,
			data: data);
	}
	
	static vector3 TargetSeekPosNoLock (
		Actor	user,
		float	height = 41) {
		
		FLineTraceData data;
		StandardTrace(user, data, height, ignore_actors: true);
		return data.hitlocation;
	}
	
	static vector3 TargetSeekPos (
		Actor	user,
		float	height = 41,
		float	target_height_f = 0.5) {
		
		FLineTraceData data;
		StandardTrace(user, data, height, ignore_actors: false);
		
		if(data.hittype == TRACE_HITACTOR) {
			if(data.hitactor.IsHostile(user) && 0 < data.hitactor.health) {
				return data.hitactor.vec3offset
					(0, 0, target_height_f * data.hitactor.height);
			}
			
			return TargetSeekPosNoLock(user, height);
		}
		
		return data.hitlocation;
	}
}